Skip to content

Add caching for DataTable._get_row_renderables()#5959

Merged
willmcgugan merged 1 commit into
Textualize:mainfrom
fancidev:data-table
Jul 25, 2025
Merged

Add caching for DataTable._get_row_renderables()#5959
willmcgugan merged 1 commit into
Textualize:mainfrom
fancidev:data-table

Conversation

@fancidev

@fancidev fancidev commented Jul 12, 2025

Copy link
Copy Markdown
Contributor

The DataTable widget appears slow to load and scroll when the number of columns is large. This PR improves the situation by adding a cache for the _get_row_renderables() method, which is called $O(m^2)$ times for each rendered row where $m$ is the number of columns. This speeds up the execution of certain benchmarks by 50x.

More details (including a benchmark script) can be found at Discussion #5953.

@willmcgugan

Copy link
Copy Markdown
Member

Thanks

@willmcgugan willmcgugan merged commit 8cfb54f into Textualize:main Jul 25, 2025
23 checks passed
@fancidev fancidev deleted the data-table branch July 25, 2025 22:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants